extends layout

block content
	link(rel='stylesheet', href='/stylesheets/category.css')
	include header

	div.category-menu
		div.container
			div.ui.large.secondary.pointing.menu
				a.item(href='/home') 主页
				each tag_item in tags
					if tag.tag_name == tag_item.tag_name
						a.tag.active.item(href='/category?tag_id='+'#{tag_item._id}'+'\&sorted='+'#{sorted}') #{tag_item.tag_name}
					else
						a.tag.item(href='/category?tag_id='+'#{tag_item._id}'+'\&sorted='+'#{sorted}') #{tag_item.tag_name}

	div.search-result
		div.container
			ul
				- var blank = 20 - music_list.length
				each music in music_list
					li
						div.item
							a(href='/music?music_id='+'#{music._id}')
								div.ui.card.small-item
									div.blurring.dimmable.image.small-item
										if music.based_on
											div.ui.left.corner.violet.label
												p.label-content 改
										else
											div.ui.left.corner.orange.label
												p.label-content 原
										img(src='/uploads/covers/'+'#{music.cover}')
										div.ui.dimmer
											div.content
												i.large.play.icon
							div.l-r
								a.title(href='/music?music_id='+'#{music._id}') #{music.name}
								div.v-desc #{music.introduction}
								div.v-info
									span.bf
										i.toggle.right.icon
										span #{music.listenN}
									span.pl
										i.comment.outline.icon
										span #{music.commentN}
								a.author(href='/user?user_id='+'#{music.author._id}') #{music.author.username}
				- for (var i = 0; i < blank; ++i)
					li(style='display:none')
						div.item
							div.ui.card.small-item
								div.blurring.dimmable.image.small-item
									div.ui.left.corner.orange.label
										p.label-content 原
									img(src='')
									div.ui.dimmer
										div.content
											i.large.play.icon
							div.l-r
								a.title(href='/')
								div.v-desc
								div.v-info
									span.bf
										i.toggle.right.icon
										span
									span.pl
										i.comment.outline.icon
										span
								a.author(href='/')
			if music_list.length == 0
				div.ui.container(style='text-align:center; padding-top:100px')
					h1.ui.header Oops！什么都没有！

		- var tot_page = Math.floor((tot_count-1)/20) + 1;
		
		div.page-selector
			div.button-groups
			div.page-jump
				p 第
				div.ui.input
					input(type="text" value="1" style="width:100%; padding:.6em .8em .6em .8em;")
				p.total /#{tot_page}
				p 页


	include footer

	script.
		window.tot_page = !{JSON.stringify(tot_page)};
		window.tag_id = !{JSON.stringify(tag._id)};
		window.sorted = !{JSON.stringify(sorted)};

	script(src="/javascripts/category.js")